package com.sdhs.safetymanage.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sdhs.common.annotation.Log;
import com.sdhs.common.core.controller.BaseController;
import com.sdhs.common.core.domain.AjaxResult;
import com.sdhs.common.enums.BusinessType;
import com.sdhs.safetymanage.domain.GcSafetyMorningMeeting;
import com.sdhs.safetymanage.service.IGcSafetyMorningMeetingService;
import com.sdhs.common.utils.poi.ExcelUtil;
import com.sdhs.common.core.page.TableDataInfo;

/**
 * 安全管理--晨会Controller
 *
 * @author andong
 * @date 2025-03-20
 */
@RestController
@RequestMapping("/safetymanage/meeting")
public class GcSafetyMorningMeetingController extends BaseController
{
    @Autowired
    private IGcSafetyMorningMeetingService gcSafetyMorningMeetingService;

    /**
     * 查询安全管理--晨会列表
     */
    @PreAuthorize("@ss.hasPermi('safetymanage:meeting:list')")
    @GetMapping("/list")
    public TableDataInfo list(GcSafetyMorningMeeting gcSafetyMorningMeeting)
    {
        startPage();
        List<GcSafetyMorningMeeting> list = gcSafetyMorningMeetingService.selectGcSafetyMorningMeetingList(gcSafetyMorningMeeting);
        return getDataTable(list);
    }

    /**
     * 导出安全管理--晨会列表
     */
    @PreAuthorize("@ss.hasPermi('safetymanage:meeting:export')")
    @Log(title = "安全管理--晨会", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GcSafetyMorningMeeting gcSafetyMorningMeeting)
    {
        List<GcSafetyMorningMeeting> list = gcSafetyMorningMeetingService.selectGcSafetyMorningMeetingList(gcSafetyMorningMeeting);
        ExcelUtil<GcSafetyMorningMeeting> util = new ExcelUtil<GcSafetyMorningMeeting>(GcSafetyMorningMeeting.class);
        util.exportExcel(response, list, "安全管理--晨会数据");
    }

    /**
     * 获取安全管理--晨会详细信息
     */
    @PreAuthorize("@ss.hasPermi('safetymanage:meeting:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(gcSafetyMorningMeetingService.selectGcSafetyMorningMeetingById(id));
    }

    /**
     * 新增安全管理--晨会
     */
    @PreAuthorize("@ss.hasPermi('safetymanage:meeting:add')")
    @Log(title = "安全管理--晨会", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GcSafetyMorningMeeting gcSafetyMorningMeeting)
    {
        return toAjax(gcSafetyMorningMeetingService.insertGcSafetyMorningMeeting(gcSafetyMorningMeeting));
    }

    /**
     * 修改安全管理--晨会
     */
    @PreAuthorize("@ss.hasPermi('safetymanage:meeting:edit')")
    @Log(title = "安全管理--晨会", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GcSafetyMorningMeeting gcSafetyMorningMeeting)
    {
        return toAjax(gcSafetyMorningMeetingService.updateGcSafetyMorningMeeting(gcSafetyMorningMeeting));
    }

    /**
     * 删除安全管理--晨会
     */
    @PreAuthorize("@ss.hasPermi('safetymanage:meeting:remove')")
    @Log(title = "安全管理--晨会", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gcSafetyMorningMeetingService.deleteGcSafetyMorningMeetingByIds(ids));
    }
}
